<template>
  <el-dialog
    title="查到签上的人"
    :visible.sync="show"
    width="600px"
    v-bind="$attrs"
    v-on="$listeners"
    @close="handleCancel"
    :close-on-click-modal="false"
    @opened="handleOpen"
    append-to-body
  >
    <!-- <el-table v-loading="loading" :border="true" :data="dataList">
      <el-table-column v-for="(column, index) in columns" :key="index" v-bind="column" />
    </el-table> -->
    <a-table
      ref="table"
      size="middle"
      :scroll="{x:true}"
      bordered
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      class="j-table-force-nowrap"
      @change="handleTableChange"
      :customRow="selectRowData">
    </a-table>
    <template #footer>
      <el-button @click="handleCancel">关 闭</el-button>
    </template>
  </el-dialog>
</template>

<script>
// import { queryMultiUsersInfo } from "@/api/wflow/design";
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { httpAction } from '@/api/manage'
export default {
  name: "QueryMultiUserModal",
  mixins:[JeecgListMixin, mixinDevice],
  props: {
    // 是否显示
    visible: {
      type: Boolean,
      default: false,
    },
    processInfo: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      loading: false,
      disableMixinCreated:true,
      columns: [
        {
          title:'用户ID',
          align:"center",
          dataIndex: 'userId'
        },
        {
         title:'用户名',
         align:"center",
         dataIndex: 'userName'
        },
      ],
      url:{
        list:'workspace/queryMultiUsersInfo',
      },
    };
  },
  computed: {
    show: {
      get() {
        return this.visible;
      },
      set(visible) {
        this.$emit("update:visible", visible);
      },
    },
  },
  methods: {
    selectRowData(record, index) {
      const that = this
      return {
        on: {
          dblclick: () => {
            this.handleDetail(record)
          },
        },
      }
    },
    // 取消操作
    handleCancel() {
      this.dataList = [];
      this.show = false;
    },
    // 打开弹框操作
    handleOpen() {
      this.loadData(1)
    },
    loadData(arg) {
      //加载数据 若传入参数1则加载第一页的内容
      if (arg === 1) {
        this.ipagination.current = 1;
      }
     const { processInstanceId, taskId } = this.processInfo; 
      this.loading = true;
      httpAction(this.url.list,{ processInstanceId, taskId },'post').then((res) => {
        if (res.success) {
          this.dataSource = res.result.records||res.result;
         this.ipagination.total = res.result.total ? res.result.total :0   
        }else{
          this.$message.warning(res.message)
        }
      }).finally(() => {
        this.loading = false
      })
    },
  },
};
</script>
